# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libmaxminddb
pkgver=1.4.2
pkgrel=2
pkgdesc="Maxmind GeoIP2 database library"
url="https://github.com/maxmind/libmaxminddb"
arch="all"
license="Apache-2.0"
depends="curl"
checkdepends="perl"
subpackages="$pkgname-dev $pkgname-doc"
source="$url/releases/download/$pkgver/$pkgname-$pkgver.tar.gz
	libmaxminddb.cron
	libmaxminddb.confd
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-pic
	make
}

check() {
	make check
}

package() {
	make install DESTDIR="$pkgdir"

	# install alpine specifics
	mkdir -p "$pkgdir"/var/lib/libmaxminddb
	install -Dm755 "$srcdir"/libmaxminddb.cron "$pkgdir"/etc/periodic/weekly/libmaxminddb
	install -Dm644 "$srcdir"/libmaxminddb.confd "$pkgdir"/etc/conf.d/libmaxminddb
}

sha512sums="bc18d2f19a74639888a466483afde1bccfc3a83787011a6f38808b76e5a513c9912ff369ccbf584091d4def657e0574b16b35dc69ab12ae4c439aaaf3669c4c1  libmaxminddb-1.4.2.tar.gz
f6d3dbee35da062a701d57dda96739dc7ccf753f30ce8a6c3b4dc281054a3a6e82cda4f515bf32652daabf85267bb3979ea0f18e6cbef270e41b2d0c72d50e1c  libmaxminddb.cron
03bdfd6d1d508ea5261a396ac9539f363dcb477b9cf11fd4c9b01001e03205fa667cde21295dc0cc3d38db50adebb9c57e147a22fc7945de7c72d75d10637128  libmaxminddb.confd"
